package com.migration.model.migration.scripts;

import com.migration.model.migration.AbstractMigrationScript;

/**
 * 操作表(risk_operations)迁移脚本
 */
public class A020_RiskOperationsMigrationScript extends AbstractMigrationScript {

    /**
     * 构造函数，初始化迁移配置
     */
    public A020_RiskOperationsMigrationScript() {
        super(
            "risk_operations",
            "操作数据迁移",
            "ra_operate",
            "risk_operations",
            20
        );
    }

    /**
     * 生成迁移数据的SQL
     *
     * @return 迁移数据的SQL
     */
    @Override
    protected String generateMigrationSql() {
        return "INSERT INTO risk_operations (\n" +
                "    id,\n" +
                "    tenant_id,\n" +
                "    operation_name,\n" +
                "    operation_desc,\n" +
                "    special_ops,\n" +
                "    operation_type,\n" +
                "    create_time,\n" +
                "    update_time,\n" +
                "    create_by,\n" +
                "    update_by,\n" +
                "    is_del\n" +
                ")\n" +
                "SELECT\n" +
                "    id,\n" +
                "    1 as tenant_id,\n" +
                "    operate_name,\n" +
                "    operate_desc,\n" +
                "    special_job,\n" +
                "    operate_type,\n" +
                "    DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s'),\n" +
                "    DATE_FORMAT(update_time, '%Y-%m-%d %H:%i:%s'),\n" +
                "    1,\n" +
                "    1,\n" +
                "    is_del\n" +
                "FROM risk_lunnan_test.ra_operate;\n";
    }

}
